unit General_code;

interface
function ReadParams(data : string; number : integer; space : boolean):string;

implementation

uses SysUtils;

function ReadParams(data : string; number : integer; space : boolean):string;
  var
    datalen,counter : integer;
    datas : integer;
    temp : char;
    datatemp , params : string;
    currentnumber : integer;
  begin
    if not( data = '') then
      begin
        datas := 0;
        counter := 0;
        datalen := 0;
        currentnumber :=0;
        if number > 0 then begin
          repeat
            currentnumber := currentnumber + 1;
            repeat
	            datas := datas + 1;
	            temp := data[datas];
            until (temp = ' ');
          until (currentnumber = number) or (temp = '');
      end;
      begin
    	  repeat
	        datalen := datalen + 1;
	        temp := data[datas + datalen];
	        datatemp := datatemp + temp ;
	      until (temp = '')or ((space=false) and (temp = ' '));
        if datalen > 1  then
	        repeat
	          counter := counter + 1;
	          params := params + data[datas + counter];
	      until counter = datalen -1;
        result:=params;
      end;
    end else result :='no data';
  end;



end.
